package com.ebs.weather_spider.controller;

import com.ebs.weather_spider.entity.WeatherCity;
import com.ebs.weather_spider.result.ResultResponse;
import com.ebs.weather_spider.service.WeatherService;
import com.ebs.weather_spider.vo.WeatherAlertVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("weather")
public class WeatherController {
    @Resource
    private WeatherService weatherService;

    /**
     * 获取河南省内天气
     *
     * @return
     */
    @GetMapping("getWeather")
    public ResultResponse<List<WeatherCity>> getWeather() {
        return weatherService.getWeather();
    }

    /**
     * 获取河南省预警信息
     * 进查询当天的预警
     *
     * @return
     */
    @GetMapping("getAlert")
    public ResultResponse<List<WeatherAlertVO>> getAlert() {
        return weatherService.getAlert();
    }
}
